package de.upb.messerschmidt.set.entity;

import java.util.ArrayList;
import java.util.Date;

import javax.jdo.annotations.Element;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

/**
 * An Event can be a conference or something likewise. It stores a list of
 * {@link Attendee}s, {@link Talk}s and a {@link Location}. Other than that it
 * has some usual attributes like a title and a date.
 * 
 * @author Tim Messerschmidt
 * 
 */

@PersistenceCapable(detachable = "true")
public class Event {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;
	@Persistent
	private Date date;
	@Persistent
	private String location;
	@Persistent
	private String title;
	@Persistent
	private String description;
	@Persistent
	private ArrayList<String> attendees = new ArrayList<String>();
	@Persistent(mappedBy = "where")
	@Element(dependent = "true")
	private ArrayList<String> talks = new ArrayList<String>();

	/**
	 * @param date
	 * @param location
	 * @param title
	 * @param attendees
	 */
	public Event(Date date, String location, String title, String desription) {
		this.date = date;
		this.location = location;
		this.title = title;
		this.description = desription;
	}

	/**
	 * @return the key
	 */
	public Key getKey() {
		return key;
	}

	/**
	 * @return the date
	 */
	public Date getDate() {
		return date;
	}

	/**
	 * @return the location
	 */
	public String getLocation() {
		return location;
	}

	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @return the attendees
	 */
	public ArrayList<String> getAttendees() {
		return attendees;
	}

	/**
	 * @return the talks
	 */
	public ArrayList<String> getTalks() {
		return talks;
	}

	/**
	 * @param key
	 *            the key to set
	 */
	public void setKey(Key key) {
		this.key = key;
	}

	/**
	 * @param date
	 *            the date to set
	 */
	public void setDate(Date date) {
		this.date = date;
	}

	/**
	 * @param location
	 *            the location to set
	 */
	public void setLocation(String location) {
		this.location = location;
	}

	/**
	 * @param title
	 *            the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @param description
	 *            the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @param attendees
	 *            the attendees to set
	 */
	public void setAttendees(ArrayList<String> attendees) {
		this.attendees = attendees;
	}

	/**
	 * @param talks
	 *            the talks to set
	 */
	public void setTalks(ArrayList<String> talks) {
		this.talks = talks;
	}
}
